<template>
	<view class="bt">
		<view class="mt-20 ptb-20 plr-36 size-26 yellow" style="background: rgba(255, 153, 0, 0.22);">
			退款申请已经提交后不可撤销和修改，保险订单将一并退款，申请后，商户将在2天内处理，超时未处理将自动退款
		</view>
		<view class="ptb-30 plr-36 bb img-shop flex1 flex-middle">
			<image src="../../static/shop-icon.png" mode=""></image>
			<text class="ml-10">{{info.shop_name}}</text>
		</view>
		<view class="plr-36 ptb-40 flex bb">
			<view class="">
				数量
			</view>
			<view class="">
				{{info.buy_count}}
			</view>
		</view>
		<view class="plr-36 ptb-40 flex bb">
			<view class="">
				退款金额（实付金额）
			</view>
			<view class="yellow">
				￥{{info.discount_price}}
			</view>
		</view>
		<view class="plr-36 ptb-20 bb">
			<view class="flex">
				<view class="">
					退回账户
				</view>
				<view class="yellow">
					￥{{info.discount_price}}
				</view>
			</view>
			<view class="size-26 gray-2 mt-15">
				(1-3个工作日到账，若原路退回失败，款项会尝试还至您钱包的余额）
			</view>
		</view>
		<view class="plr-36 ptb-20 bb">
			<view class="">
				退款原因（必填）
			</view>
			<view class="flex1 flex-middle mt-20">
				<view :class="[isActive==1?'bg-yellow white':'border gray-2','mr-20 ptb-10 plr-25 radius-10']" @click="isActive=1">
					对服务不满意
				</view>
				<view :class="[isActive==2?'bg-yellow white':'border gray-2','mr-20 ptb-10 plr-25 radius-10']" @click="isActive=2">
					商家不接待
				</view>
				<view :class="[isActive==0?'bg-yellow white':'border gray-2','mr-20 ptb-10 plr-25 radius-10']" @click="isActive=0">
					其他原因
				</view>
			</view>
		</view>
		<view class="fixed-bottom pb-60">
			<u-button :disabled="isActive==4" type="warning" @click="refund">申请退款</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				order_id:'',
				info:{},
				isActive:4
			};
		},
		onLoad(option) {
			this.order_id = option.order_id
			this.init()
		},
		methods:{
			init() {
				this.$http('/api/order/info', {
					order_id: this.order_id
				}).then(data => {
					this.info = data
				})
			},
			refund() {
				this.$http('/api/order/refund', {
					order_id: this.order_id,
					reason: this.isActive
				},"POST").then(data => {
					uni.showToast({
						title:'退款已申请，审核中'
					})
					setTimeout(()=>{
						uni.navigateBack({
							
						})
					},1000)
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.u-cell_title{
		font-weight: 400 !important;
	}
	/deep/.u-warning-hover {
		background-color: $yellow !important;
	}
	/deep/.u-btn--warning--disabled {
		background-color: $bg-1 !important;
	}
	.img-shop{
		image{
			width: 34rpx;
			height: 34rpx;
		}
	}
</style>
